37. Solution: Compound Data Structions

Quiz Solution: Adding Values to Nested Dictionaries

Here's my solution!

elements = {'hydrogen': {'number': 1, 'weight': 1.00794, 'symbol': 'H'},
            'helium': {'number': 2, 'weight': 4.002602, 'symbol': 'He'}}

elements['hydrogen']['is_noble_gas'] = False
elements['helium']['is_noble_gas'] = True

Notice the last two lines are the solution necessary to add the is_noble_gas key to each of the dictionaries, so the final result would be correct after running these two lines.